import request from '/@/utils/requestWCF';

// 获取到的是最终的数据 response.data.result
// 使用举例: return axiosGet(service + `get/${id}`) as Promise<ExaQuestionOutput>;
// 如果有多个参数请用POST请求
export function axiosGet<T = any>(applicationPath: string, prefix = ''): Promise<T> {
	return request({
		url: applicationPath,
		method: 'get',
	});
}

// 获取到的是最终的数据 response.data.result
// 使用举例: return axiosPost(service + 'page', data)
export function axiosPost<T = any>(applicationPath: string, data: any, prefix = ''): Promise<T> {


	return request({
		url: applicationPath,
		method: 'POST',
		data: data,
	});
}

// 获取到的是最终的数据 response.data.result
// 使用举例: return axiosPut(service + 'update', data)
export function axiosPut<T = any>(applicationPath: string, data: any, prefix = ''): Promise<T> {
	return request({
		url: applicationPath,
		method: 'put',
		data,
	});
}

// 获取到的是最终的数据 response.data.result
// 举例: return axiosDelete(service + `delete/${id}`) as Promise<boolean>;
// 如果有多个参数请用POST请求
export function axiosDelete<T = any>(applicationPath: string, prefix = ''): Promise<T> {
	return request({
		url: applicationPath,
		method: 'delete',
	});
}
